package com.opensource.svgaplayer.proto;

import com.squareup.wire.*;
import com.squareup.wire.internal.Internal;
import okio.ByteString;

import java.io.IOException;

/**
 * ex.
 *
 * @author wl
 * @since 2021-06-28
 */
public final class ShapeEntity extends Message<ShapeEntity, ShapeEntity.Builder> {
    public final static ProtoAdapter<ShapeEntity>  ADAPTER = new ProtoAdapter_ShapeEntity();
    public static final ShapeType DEFAULT_TYPE = ShapeType.SHAPE;

    /**
     * 矢量类型
     */
    @WireField(
            tag = 1,
            adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeType#ADAPTER"
    )
    public final ShapeType type;

    /**
     * 矢量参数
     * 渲染参数
     */
    @WireField(
            tag = 10,
            adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeStyle#ADAPTER"
    )
    public ShapeStyle styles;

    /**
     * 矢量图层 2D 变换矩阵
     */
    @WireField(
            tag = 11,
            adapter = "com.opensource.svgaplayer.proto.Transform#ADAPTER"
    )
    public Transform transform;

    @WireField(
            tag = 2,
            adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeArgs#ADAPTER"
    )
    public ShapeArgs shape;

    @WireField(
            tag = 3,
            adapter = "com.opensource.svgaplayer.proto.ShapeEntity$RectArgs#ADAPTER"
    )
    public RectArgs rect;

    @WireField(
            tag = 4,
            adapter = "com.opensource.svgaplayer.proto.ShapeEntity$EllipseArgs#ADAPTER"
    )
    public EllipseArgs ellipse;

    /**
     * ShapeEntity
     *
     * @param type      ShapeType
     * @param styles    ShapeStyle
     * @param transform Transform
     * @param shape     ShapeArgs
     * @param rect      RectArgs
     * @param ellipse   EllipseArgs
     */
    public ShapeEntity(ShapeType type, ShapeStyle styles, Transform transform, ShapeArgs shape, RectArgs rect, EllipseArgs ellipse) {
        this(type, styles, transform, shape, rect, ellipse, ByteString.EMPTY);
    }

    /**
     * ShapeEntity
     *
     * @param type          ShapeType
     * @param styles        ShapeStyle
     * @param transform     Transform
     * @param shape         ShapeArgs
     * @param rect          RectArgs
     * @param ellipse       EllipseArgs
     * @param unknownFields ByteString
     */
    public ShapeEntity(ShapeType type, ShapeStyle styles, Transform transform, ShapeArgs shape, RectArgs rect, EllipseArgs ellipse, ByteString unknownFields) {
        super(ADAPTER, unknownFields);
        if (Internal.countNonNull(shape, rect, ellipse) > 1) {
            throw new IllegalArgumentException("at most one of shape, rect, ellipse may be non-null");
        }
        this.type = type;
        this.styles = styles;
        this.transform = transform;
        this.shape = shape;
        this.rect = rect;
        this.ellipse = ellipse;
    }

    /**
     * newBuilder
     *
     * @return Builder
     */
    @Override
    public Builder newBuilder() {
        Builder builder = new Builder();
        builder.type = type;
        builder.styles = styles;
        builder.transform = transform;
        builder.shape = shape;
        builder.rect = rect;
        builder.ellipse = ellipse;
        builder.addUnknownFields(unknownFields());
        return builder;
    }

    /**
     * equals
     *
     * @param other Object
     * @return boolean
     */
    @Override
    public boolean equals(Object other) {
        if (other == this) return true;
        if (!(other instanceof ShapeEntity)) return false;
        ShapeEntity o = (ShapeEntity) other;
        return unknownFields().equals(o.unknownFields())
                && Internal.equals(type, o.type)
                && Internal.equals(styles, o.styles)
                && Internal.equals(transform, o.transform)
                && Internal.equals(shape, o.shape)
                && Internal.equals(rect, o.rect)
                && Internal.equals(ellipse, o.ellipse);
    }

    /**
     * hashCode
     *
     * @return int
     */
    @Override
    public int hashCode() {
        int result = super.hashCode;
        if (result == 0) {
            result = unknownFields().hashCode();
            result = result * 37 + (type != null ? type.hashCode() : 0);
            result = result * 37 + (styles != null ? styles.hashCode() : 0);
            result = result * 37 + (transform != null ? transform.hashCode() : 0);
            result = result * 37 + (shape != null ? shape.hashCode() : 0);
            result = result * 37 + (rect != null ? rect.hashCode() : 0);
            result = result * 37 + (ellipse != null ? ellipse.hashCode() : 0);
            super.hashCode = result;
        }
        return result;
    }

    /**
     * toString
     *
     * @return String
     */
    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        if (type != null) builder.append(", type=").append(type);
        if (styles != null) builder.append(", styles=").append(styles);
        if (transform != null) builder.append(", transform=").append(transform);
        if (shape != null) builder.append(", shape=").append(shape);
        if (rect != null) builder.append(", rect=").append(rect);
        if (ellipse != null) builder.append(", ellipse=").append(ellipse);
        return builder.replace(0, 2, "ShapeEntity{").append('}').toString();
    }

    public static class Builder extends Message.Builder<ShapeEntity, Builder> {
        public ShapeType type;
        public ShapeStyle styles;
        public Transform transform;
        public ShapeArgs shape;
        public RectArgs rect;
        public EllipseArgs ellipse;

        /**
         * Builder
         */
        public Builder() {
        }

        /**
         * 矢量类型
         *
         * @param type ShapeType
         * @return Builder
         */
        public Builder type(ShapeType type) {
            this.type = type;
            return this;
        }

        /**
         * 矢量参数
         * 渲染参数
         *
         * @param styles ShapeStyle
         * @return Builder
         */
        public Builder styles(ShapeStyle styles) {
            this.styles = styles;
            return this;
        }

        /**
         * 矢量图层 2D 变换矩阵
         *
         * @param transform Transform
         * @return Builder
         */
        public Builder transform(Transform transform) {
            this.transform = transform;
            return this;
        }

        /**
         * shape
         *
         * @param shape ShapeArgs
         * @return Builder
         */
        public Builder shape(ShapeArgs shape) {
            this.shape = shape;
            this.rect = null;
            this.ellipse = null;
            return this;
        }

        /**
         * rect
         *
         * @param rect RectArgs
         * @return Builder
         */
        public Builder rect(RectArgs rect) {
            this.rect = rect;
            this.shape = null;
            this.ellipse = null;
            return this;
        }

        /**
         * ellipse
         *
         * @param ellipse EllipseArgs
         * @return Builder
         */
        public Builder ellipse(EllipseArgs ellipse) {
            this.ellipse = ellipse;
            this.shape = null;
            this.rect = null;
            return this;
        }

        /**
         * build
         *
         * @return ShapeEntity
         */
        @Override
        public ShapeEntity build() {
            return new ShapeEntity(type, styles, transform, shape, rect, ellipse, super.buildUnknownFields());
        }
    }

    public enum ShapeType implements WireEnum {
        /**
         * 路径
         */
        SHAPE(0),

        /**
         * 矩形
         */
        RECT(1),

        /**
         * 圆形
         */
        ELLIPSE(2),

        /**
         * 与前帧一致
         */
        KEEP(3);

        public static final ProtoAdapter<ShapeType> ADAPTER = ProtoAdapter.newEnumAdapter(ShapeType.class);

        private int value;

        ShapeType(int value) {
            this.value = value;
        }

        /**
         * Return the constant for {@code value} or null.
         *
         * @param value
         * @return ShapeType
         */
        public static ShapeType fromValue(int value) {
            switch (value) {
                case 0:
                    return SHAPE;
                case 1:
                    return RECT;
                case 2:
                    return ELLIPSE;
                case 3:
                    return KEEP;
                default:
                    return null;
            }
        }

        /**
         * getValue
         *
         * @return int
         */
        @Override
        public int getValue() {
            return value;
        }
    }

    public static final class ShapeArgs extends Message<ShapeArgs, ShapeArgs.Builder> {
        public final static ProtoAdapter<ShapeArgs> ADAPTER = new ProtoAdapter_ShapeArgs();
        public static String DEFAULT_D = "";

        /**
         * SVG 路径
         */
        @WireField(
                tag = 1,
                adapter = "com.squareup.wire.ProtoAdapter#STRING"
        )
        public String d;

        /**
         * ShapeArgs
         *
         * @param d String
         */
        public ShapeArgs(String d) {
            this(d, ByteString.EMPTY);
        }

        /**
         * ShapeArgs
         *
         * @param d             String
         * @param unknownFields ByteString
         */
        public ShapeArgs(String d, ByteString unknownFields) {
            super(ADAPTER, unknownFields);
            this.d = d;
        }

        /**
         * newBuilder
         *
         * @return Builder
         */
        @Override
        public Builder newBuilder() {
            Builder builder = new Builder();
            builder.d = d;
            builder.addUnknownFields(unknownFields());
            return builder;
        }

        /**
         * equals
         *
         * @param other Object
         * @return boolean
         */
        @Override
        public boolean equals(Object other) {
            if (other == this) return true;
            if (!(other instanceof ShapeArgs)) return false;
            ShapeArgs o = (ShapeArgs) other;
            return unknownFields().equals(o.unknownFields())
                    && Internal.equals(d, o.d);
        }

        /**
         * hashCode
         *
         * @return int
         */
        @Override
        public int hashCode() {
            int result = super.hashCode;
            if (result == 0) {
                result = unknownFields().hashCode();
                result = result * 37 + (d != null ? d.hashCode() : 0);
                super.hashCode = result;
            }
            return result;
        }

        /**
         * toString
         *
         * @return String
         */
        @Override
        public String toString() {
            StringBuilder builder = new StringBuilder();
            if (d != null) builder.append(", d=").append(d);
            return builder.replace(0, 2, "ShapeArgs{").append('}').toString();
        }

        public static class Builder extends Message.Builder<ShapeArgs, Builder> {
            public String d;

            /**
             * Builder
             */
            public Builder() {
            }

            /**
             * SVG 路径
             *
             * @param d String
             * @return Builder
             */
            public Builder d(String d) {
                this.d = d;
                return this;
            }

            /**
             * build
             *
             * @return ShapeArgs
             */
            @Override
            public ShapeArgs build() {
                return new ShapeArgs(d, super.buildUnknownFields());
            }
        }

        private static class ProtoAdapter_ShapeArgs extends ProtoAdapter<ShapeArgs> {
            ProtoAdapter_ShapeArgs() {
                super(FieldEncoding.LENGTH_DELIMITED, ShapeArgs.class);
            }

            /**
             * encodedSize
             *
             * @param value ShapeArgs
             * @return int
             */
            @Override
            public int encodedSize(ShapeArgs value) {
                return (value.d != null ? ProtoAdapter.STRING.encodedSizeWithTag(1, value.d) : 0)
                        + value.unknownFields().size();
            }

            /**
             * encode
             *
             * @param writer ProtoWriter
             * @param value  ShapeArgs
             * @throws IOException
             */
            @Override
            public void encode(ProtoWriter writer, ShapeArgs value) throws IOException {
                if (value.d != null) ProtoAdapter.STRING.encodeWithTag(writer, 1, value.d);
                writer.writeBytes(value.unknownFields());
            }

            /**
             * decode
             *
             * @param reader ProtoReader
             * @return ShapeArgs
             * @throws IOException
             */
            @Override
            public ShapeArgs decode(ProtoReader reader) throws IOException {
                Builder builder = new Builder();
                long token = reader.beginMessage();
                for (int tag; (tag = reader.nextTag()) != -1; ) {
                    switch (tag) {
                        case 1:
                            builder.d(ProtoAdapter.STRING.decode(reader));
                            break;
                        default: {
                            FieldEncoding fieldEncoding = reader.peekFieldEncoding();
                            Object value = fieldEncoding.rawProtoAdapter().decode(reader);
                            builder.addUnknownField(tag, fieldEncoding, value);
                        }
                    }
                }
                reader.endMessage(token);
                return builder.build();
            }

            /**
             * redact
             *
             * @param value ShapeArgs
             * @return ShapeArgs
             */
            @Override
            public ShapeArgs redact(ShapeArgs value) {
                Builder builder = value.newBuilder();
                builder.clearUnknownFields();
                return builder.build();
            }
        }
    }

    public static class RectArgs extends Message<RectArgs, RectArgs.Builder> {
        public static final ProtoAdapter<RectArgs> ADAPTER = new ProtoAdapter_RectArgs();
        public static final float DEFAULT_X = 0.0f;
        public static final float DEFAULT_Y = 0.0f;
        public static final float DEFAULT_WIDTH = 0.0f;
        public static final float DEFAULT_HEIGHT = 0.0f;
        public static final float DEFAULT_CORNERRADIUS = 0.0f;

        @WireField(
                tag = 1,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float x;

        @WireField(
                tag = 2,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float y;

        @WireField(
                tag = 3,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float width;

        @WireField(
                tag = 4,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float height;

        /**
         * 圆角半径
         */
        @WireField(
                tag = 5,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float cornerRadius;

        /**
         * RectArgs
         *
         * @param x            float
         * @param y            float
         * @param width        float
         * @param height       float
         * @param cornerRadius float
         */
        public RectArgs(float x, float y, float width, float height, float cornerRadius) {
            this(x, y, width, height, cornerRadius, ByteString.EMPTY);
        }

        /**
         * RectArgs
         *
         * @param x             float
         * @param y             float
         * @param width         float
         * @param height        float
         * @param cornerRadius  float
         * @param unknownFields ByteString
         */
        public RectArgs(float x, float y, float width, float height, float cornerRadius, ByteString unknownFields) {
            super(ADAPTER, unknownFields);
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
            this.cornerRadius = cornerRadius;
        }

        /**
         * newBuilder
         *
         * @return Builder
         */
        @Override
        public Builder newBuilder() {
            Builder builder = new Builder();
            builder.x = x;
            builder.y = y;
            builder.width = width;
            builder.height = height;
            builder.cornerRadius = cornerRadius;
            builder.addUnknownFields(unknownFields());
            return builder;
        }

        /**
         * equals
         *
         * @param other Object
         * @return boolean
         */
        @Override
        public boolean equals(Object other) {
            if (other == this) return true;
            if (!(other instanceof RectArgs)) return false;
            RectArgs o = (RectArgs) other;
            return unknownFields().equals(o.unknownFields())
                    && Internal.equals(x, o.x)
                    && Internal.equals(y, o.y)
                    && Internal.equals(width, o.width)
                    && Internal.equals(height, o.height)
                    && Internal.equals(cornerRadius, o.cornerRadius);
        }

        /**
         * hashCode
         *
         * @return int
         */
        @Override
        public int hashCode() {
            int result = super.hashCode;
            if (result == 0) {
                result = unknownFields().hashCode();
                result = result * 37 + (new Float(x).hashCode());
                result = result * 37 + (new Float(y).hashCode());
                result = result * 37 + (new Float(width).hashCode());
                result = result * 37 + (new Float(height).hashCode());
                result = result * 37 + (new Float(cornerRadius).hashCode());
                super.hashCode = result;
            }
            return result;
        }

        /**
         * toString
         *
         * @return String
         */
        @Override
        public String toString() {
            StringBuilder builder = new StringBuilder();
            builder.append(", x=").append(x);
            builder.append(", y=").append(y);
            builder.append(", width=").append(width);
            builder.append(", height=").append(height);
            builder.append(", cornerRadius=").append(cornerRadius);
            return builder.replace(0, 2, "RectArgs{").append('}').toString();
        }

        public static class Builder extends Message.Builder<RectArgs, Builder> {
            public float x;
            public float y;
            public float width;
            public float height;
            public float cornerRadius;

            /**
             * Builder
             */
            public Builder() {
            }

            /**
             * x
             *
             * @param x float
             * @return Builder
             */
            public Builder x(float x) {
                this.x = x;
                return this;
            }

            /**
             * y
             *
             * @param y float
             * @return Builder
             */
            public Builder y(float y) {
                this.y = y;
                return this;
            }

            /**
             * width
             *
             * @param width float
             * @return Builder
             */
            public Builder width(float width) {
                this.width = width;
                return this;
            }

            /**
             * height
             *
             * @param height float
             * @return Builder
             */
            public Builder height(float height) {
                this.height = height;
                return this;
            }

            /**
             * 圆角半径
             *
             * @param cornerRadius float
             * @return Builder
             */
            public Builder cornerRadius(float cornerRadius) {
                this.cornerRadius = cornerRadius;
                return this;
            }

            /**
             * build
             *
             * @return RectArgs
             */
            @Override
            public RectArgs build() {
                return new RectArgs(x, y, width, height, cornerRadius, super.buildUnknownFields());
            }
        }

        private static class ProtoAdapter_RectArgs extends ProtoAdapter<RectArgs> {
            ProtoAdapter_RectArgs() {
                super(FieldEncoding.LENGTH_DELIMITED, RectArgs.class);
            }

            /**
             * encodedSize
             *
             * @param value RectArgs
             * @return int
             */
            @Override
            public int encodedSize(RectArgs value) {
                return ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.x)
                        + ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.y)
                        + ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.width)
                        + ProtoAdapter.FLOAT.encodedSizeWithTag(4, value.height)
                        + ProtoAdapter.FLOAT.encodedSizeWithTag(5, value.cornerRadius)
                        + value.unknownFields().size();
            }

            /**
             * encode
             *
             * @param writer ProtoWriter
             * @param value  RectArgs
             * @throws IOException
             */
            @Override
            public void encode(ProtoWriter writer, RectArgs value) throws IOException {
                ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.x);
                ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.y);
                ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.width);
                ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.height);
                ProtoAdapter.FLOAT.encodeWithTag(writer, 5, value.cornerRadius);
                writer.writeBytes(value.unknownFields());
            }

            /**
             * decode
             *
             * @param reader ProtoReader
             * @return RectArgs
             * @throws IOException
             */
            @Override
            public RectArgs decode(ProtoReader reader) throws IOException {
                Builder builder = new Builder();
                long token = reader.beginMessage();
                for (int tag; (tag = reader.nextTag()) != -1; ) {
                    switch (tag) {
                        case 1:
                            builder.x(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        case 2:
                            builder.y(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        case 3:
                            builder.width(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        case 4:
                            builder.height(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        case 5:
                            builder.cornerRadius(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        default: {
                            FieldEncoding fieldEncoding = reader.peekFieldEncoding();
                            Object value = fieldEncoding.rawProtoAdapter().decode(reader);
                            builder.addUnknownField(tag, fieldEncoding, value);
                        }
                    }
                }
                reader.endMessage(token);
                return builder.build();
            }

            /**
             * redact
             *
             * @param value RectArgs
             * @return RectArgs
             */
            @Override
            public RectArgs redact(RectArgs value) {
                Builder builder = value.newBuilder();
                builder.clearUnknownFields();
                return builder.build();
            }
        }
    }

    public static final class EllipseArgs extends Message<EllipseArgs, EllipseArgs.Builder> {
        public static final ProtoAdapter<EllipseArgs> ADAPTER = new ProtoAdapter_EllipseArgs();
        public static final float DEFAULT_X = 0.0f;
        public static final float DEFAULT_Y = 0.0f;
        public static final float DEFAULT_RADIUSX = 0.0f;
        public static final float DEFAULT_RADIUSY = 0.0f;

        /**
         * 圆中心点 X
         */
        @WireField(
                tag = 1,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float x;

        /**
         * 圆中心点 Y
         */
        @WireField(
                tag = 2,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float y;

        /**
         * 横向半径
         */
        @WireField(
                tag = 3,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float radiusX;

        /**
         * 纵向半径
         */
        @WireField(
                tag = 4,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float radiusY;

        /**
         * EllipseArgs
         *
         * @param x       float
         * @param y       float
         * @param radiusX float
         * @param radiusY float
         */
        public EllipseArgs(float x, float y, float radiusX, float radiusY) {
            this(x, y, radiusX, radiusY, ByteString.EMPTY);
        }

        /**
         * EllipseArgs
         *
         * @param x             float
         * @param y             float
         * @param radiusX       float
         * @param radiusY       float
         * @param unknownFields ByteString
         */
        public EllipseArgs(float x, float y, float radiusX, float radiusY, ByteString unknownFields) {
            super(ADAPTER, unknownFields);
            this.x = x;
            this.y = y;
            this.radiusX = radiusX;
            this.radiusY = radiusY;
        }

        /**
         * newBuilder
         *
         * @return Builder
         */
        @Override
        public Builder newBuilder() {
            Builder builder = new Builder();
            builder.x = x;
            builder.y = y;
            builder.radiusX = radiusX;
            builder.radiusY = radiusY;
            builder.addUnknownFields(unknownFields());
            return builder;
        }

        /**
         * equals
         *
         * @param other Object
         * @return boolean
         */
        @Override
        public boolean equals(Object other) {
            if (other == this) return true;
            if (!(other instanceof EllipseArgs)) return false;
            EllipseArgs o = (EllipseArgs) other;
            return unknownFields().equals(o.unknownFields())
                    && Internal.equals(x, o.x)
                    && Internal.equals(y, o.y)
                    && Internal.equals(radiusX, o.radiusX)
                    && Internal.equals(radiusY, o.radiusY);
        }

        /**
         * hashCode
         *
         * @return int
         */
        @Override
        public int hashCode() {
            int result = super.hashCode;
            if (result == 0) {
                result = unknownFields().hashCode();
                result = result * 37 + (new Float(x).hashCode());
                result = result * 37 + (new Float(y).hashCode());
                result = result * 37 + (new Float(radiusX).hashCode());
                result = result * 37 + (new Float(radiusY).hashCode());
                super.hashCode = result;
            }
            return result;
        }

        /**
         * toString
         *
         * @return String
         */
        @Override
        public String toString() {
            StringBuilder builder = new StringBuilder();
            builder.append(", x=").append(x);
            builder.append(", y=").append(y);
            builder.append(", radiusX=").append(radiusX);
            builder.append(", radiusY=").append(radiusY);
            return builder.replace(0, 2, "EllipseArgs{").append('}').toString();
        }

        public static class Builder extends Message.Builder<EllipseArgs, Builder> {
            public float x = 0.0f;
            public float y = 0.0f;
            public float radiusX = 0.0f;
            public float radiusY = 0.0f;

            /**
             * Builder
             */
            public Builder() {
            }

            /**
             * 圆中心点 X
             *
             * @param x float
             * @return Builder
             */
            public Builder x(float x) {
                this.x = x;
                return this;
            }

            /**
             * 圆中心点 Y
             *
             * @param y float
             * @return Builder
             */
            public Builder y(float y) {
                this.y = y;
                return this;
            }

            /**
             * 横向半径
             *
             * @param radiusX float
             * @return Builder
             */
            public Builder radiusX(float radiusX) {
                this.radiusX = radiusX;
                return this;
            }

            /**
             * 纵向半径
             *
             * @param radiusY float
             * @return Builder
             */
            public Builder radiusY(float radiusY) {
                this.radiusY = radiusY;
                return this;
            }

            /**
             * build
             *
             * @return EllipseArgs
             */
            @Override
            public EllipseArgs build() {
                return new EllipseArgs(x, y, radiusX, radiusY, super.buildUnknownFields());
            }
        }

        private static class ProtoAdapter_EllipseArgs extends ProtoAdapter<EllipseArgs> {
            ProtoAdapter_EllipseArgs() {
                super(FieldEncoding.LENGTH_DELIMITED, EllipseArgs.class);
            }

            /**
             * encodedSize
             *
             * @param value EllipseArgs
             * @return int
             */
            @Override
            public int encodedSize(EllipseArgs value) {
                return ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.x)
                        + ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.y)
                        + ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.radiusX)
                        + ProtoAdapter.FLOAT.encodedSizeWithTag(4, value.radiusY)
                        + value.unknownFields().size();
            }

            /**
             * encode
             *
             * @param writer ProtoWriter
             * @param value  EllipseArgs
             * @throws IOException
             */
            @Override
            public void encode(ProtoWriter writer, EllipseArgs value) throws IOException {
                ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.x);
                ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.y);
                ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.radiusX);
                ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.radiusY);
                writer.writeBytes(value.unknownFields());
            }

            /**
             * decode
             *
             * @param reader ProtoReader
             * @return EllipseArgs
             * @throws IOException
             */
            @Override
            public EllipseArgs decode(ProtoReader reader) throws IOException {
                Builder builder = new Builder();
                long token = reader.beginMessage();
                for (int tag; (tag = reader.nextTag()) != -1; ) {
                    switch (tag) {
                        case 1:
                            builder.x(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        case 2:
                            builder.y(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        case 3:
                            builder.radiusX(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        case 4:
                            builder.radiusY(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        default: {
                            FieldEncoding fieldEncoding = reader.peekFieldEncoding();
                            Object value = fieldEncoding.rawProtoAdapter().decode(reader);
                            builder.addUnknownField(tag, fieldEncoding, value);
                        }
                    }
                }
                reader.endMessage(token);
                return builder.build();
            }

            /**
             * redact
             *
             * @param value EllipseArgs
             * @return EllipseArgs
             */
            @Override
            public EllipseArgs redact(EllipseArgs value) {
                Builder builder = value.newBuilder();
                builder.clearUnknownFields();
                return builder.build();
            }
        }
    }

    public static final class ShapeStyle extends Message<ShapeStyle, ShapeStyle.Builder> {
        public static final ProtoAdapter<ShapeStyle> ADAPTER = new ProtoAdapter_ShapeStyle();
        public static final float DEFAULT_STROKEWIDTH = 0.0f;
        public static final LineCap DEFAULT_LINECAP = LineCap.LineCap_BUTT;
        public static final LineJoin DEFAULT_LINEJOIN = LineJoin.LineJoin_MITER;
        public static final float DEFAULT_MITERLIMIT = 0.0f;
        public static final float DEFAULT_LINEDASHI = 0.0f;
        public static final float DEFAULT_LINEDASHII = 0.0f;
        public static final float DEFAULT_LINEDASHIII = 0.0f;

        /**
         * 填充色
         */
        @WireField(
                tag = 1,
                adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeStyle$RGBAColor#ADAPTER"
        )
        public RGBAColor fill;

        /**
         * 描边色
         */
        @WireField(
                tag = 2,
                adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeStyle$RGBAColor#ADAPTER"
        )
        public RGBAColor stroke;

        /**
         * 描边宽
         */
        @WireField(
                tag = 3,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float strokeWidth;

        /**
         * 线段端点样式
         */
        @WireField(
                tag = 4,
                adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeStyle$LineCap#ADAPTER"
        )
        public LineCap lineCap;

        /**
         * 线段连接样式
         */
        @WireField(
                tag = 5,
                adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeStyle$LineJoin#ADAPTER"
        )
        public LineJoin lineJoin;

        /**
         * 尖角限制
         */
        @WireField(
                tag = 6,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float miterLimit;

        /**
         * 虚线参数 Dash
         */
        @WireField(
                tag = 7,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float lineDashI;

        /**
         * 虚线参数 Gap
         */
        @WireField(
                tag = 8,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float lineDashII;

        /**
         * 虚线参数 Offset
         */
        @WireField(
                tag = 9,
                adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
        )
        public float lineDashIII;

        /**
         * ShapeStyle
         *
         * @param fill        RGBAColor
         * @param stroke      RGBAColor
         * @param strokeWidth float
         * @param lineCap     LineCap
         * @param lineJoin    LineJoin
         * @param miterLimit  float
         * @param lineDashI   float
         * @param lineDashII  float
         * @param lineDashIII float
         */
        public ShapeStyle(RGBAColor fill, RGBAColor stroke, float strokeWidth, LineCap lineCap, LineJoin lineJoin, float miterLimit, float lineDashI, float lineDashII, float lineDashIII) {
            this(fill, stroke, strokeWidth, lineCap, lineJoin, miterLimit, lineDashI, lineDashII, lineDashIII, ByteString.EMPTY);
        }

        /**
         * ShapeStyle
         *
         * @param fill          RGBAColor
         * @param stroke        RGBAColor
         * @param strokeWidth   float
         * @param lineCap       LineCap
         * @param lineJoin      LineJoin
         * @param miterLimit    float
         * @param lineDashI     float
         * @param lineDashII    float
         * @param lineDashIII   float
         * @param unknownFields ByteString
         */
        public ShapeStyle(RGBAColor fill, RGBAColor stroke, float strokeWidth, LineCap lineCap, LineJoin lineJoin, float miterLimit, float lineDashI, float lineDashII, float lineDashIII, ByteString unknownFields) {
            super(ADAPTER, unknownFields);
            this.fill = fill;
            this.stroke = stroke;
            this.strokeWidth = strokeWidth;
            this.lineCap = lineCap;
            this.lineJoin = lineJoin;
            this.miterLimit = miterLimit;
            this.lineDashI = lineDashI;
            this.lineDashII = lineDashII;
            this.lineDashIII = lineDashIII;
        }

        /**
         * newBuilder
         *
         * @return Builder
         */
        @Override
        public Builder newBuilder() {
            Builder builder = new Builder();
            builder.fill = fill;
            builder.stroke = stroke;
            builder.strokeWidth = strokeWidth;
            builder.lineCap = lineCap;
            builder.lineJoin = lineJoin;
            builder.miterLimit = miterLimit;
            builder.lineDashI = lineDashI;
            builder.lineDashII = lineDashII;
            builder.lineDashIII = lineDashIII;
            builder.addUnknownFields(unknownFields());
            return builder;
        }

        /**
         * equals
         *
         * @param other Object
         * @return boolean
         */
        @Override
        public boolean equals(Object other) {
            if (other == this) return true;
            if (!(other instanceof ShapeStyle)) return false;
            ShapeStyle o = (ShapeStyle) other;
            return unknownFields().equals(o.unknownFields())
                    && Internal.equals(fill, o.fill)
                    && Internal.equals(stroke, o.stroke)
                    && Internal.equals(strokeWidth, o.strokeWidth)
                    && Internal.equals(lineCap, o.lineCap)
                    && Internal.equals(lineJoin, o.lineJoin)
                    && Internal.equals(miterLimit, o.miterLimit)
                    && Internal.equals(lineDashI, o.lineDashI)
                    && Internal.equals(lineDashII, o.lineDashII)
                    && Internal.equals(lineDashIII, o.lineDashIII);
        }

        /**
         * hashCode
         *
         * @return int
         */
        @Override
        public int hashCode() {
            int result = super.hashCode;
            if (result == 0) {
                result = unknownFields().hashCode();
                result = result * 37 + (fill != null ? fill.hashCode() : 0);
                result = result * 37 + (stroke != null ? stroke.hashCode() : 0);
                result = result * 37 + (new Float(strokeWidth).hashCode());
                result = result * 37 + (lineCap != null ? lineCap.hashCode() : 0);
                result = result * 37 + (lineJoin != null ? lineJoin.hashCode() : 0);
                result = result * 37 + (new Float(miterLimit).hashCode());
                result = result * 37 + (new Float(lineDashI).hashCode());
                result = result * 37 + (new Float(lineDashII).hashCode());
                result = result * 37 + (new Float(lineDashIII).hashCode());
                super.hashCode = result;
            }
            return result;
        }

        /**
         * toString
         *
         * @return String
         */
        @Override
        public String toString() {
            StringBuilder builder = new StringBuilder();
            if (fill != null) builder.append(", fill=").append(fill);
            if (stroke != null) builder.append(", stroke=").append(stroke);
            builder.append(", strokeWidth=").append(strokeWidth);
            if (lineCap != null) builder.append(", lineCap=").append(lineCap);
            if (lineJoin != null) builder.append(", lineJoin=").append(lineJoin);
            builder.append(", miterLimit=").append(miterLimit);
            builder.append(", lineDashI=").append(lineDashI);
            builder.append(", lineDashII=").append(lineDashII);
            builder.append(", lineDashIII=").append(lineDashIII);
            return builder.replace(0, 2, "ShapeStyle{").append('}').toString();
        }

        public static final class Builder extends Message.Builder<ShapeStyle, Builder> {
            public RGBAColor fill;
            public RGBAColor stroke;
            public float strokeWidth = 0.0f;
            public LineCap lineCap;
            public LineJoin lineJoin;
            public float miterLimit = 0.0f;
            public float lineDashI = 0.0f;
            public float lineDashII = 0.0f;
            public float lineDashIII = 0.0f;

            /**
             * Builder
             */
            public Builder() {
            }

            /**
             * 填充色
             *
             * @param fill RGBAColor
             * @return Builder
             */
            public Builder fill(RGBAColor fill) {
                this.fill = fill;
                return this;
            }

            /**
             * 描边色
             *
             * @param stroke RGBAColor
             * @return Builder
             */
            public Builder stroke(RGBAColor stroke) {
                this.stroke = stroke;
                return this;
            }

            /**
             * 描边宽
             *
             * @param strokeWidth float
             * @return Builder
             */
            public Builder strokeWidth(float strokeWidth) {
                this.strokeWidth = strokeWidth;
                return this;
            }

            /**
             * 线段端点样式
             *
             * @param lineCap LineCap
             * @return Builder
             */
            public Builder lineCap(LineCap lineCap) {
                this.lineCap = lineCap;
                return this;
            }

            /**
             * 线段连接样式
             *
             * @param lineJoin lineJoin
             * @return Builder
             */
            public Builder lineJoin(LineJoin lineJoin) {
                this.lineJoin = lineJoin;
                return this;
            }

            /**
             * 尖角限制
             *
             * @param miterLimit float
             * @return Builder
             */
            public Builder miterLimit(float miterLimit) {
                this.miterLimit = miterLimit;
                return this;
            }

            /**
             * 虚线参数 Dash
             *
             * @param lineDashI float
             * @return Builder
             */
            public Builder lineDashI(float lineDashI) {
                this.lineDashI = lineDashI;
                return this;
            }

            /**
             * 虚线参数 Gap
             *
             * @param lineDashII float
             * @return Builder
             */
            public Builder lineDashII(float lineDashII) {
                this.lineDashII = lineDashII;
                return this;
            }

            /**
             * 虚线参数 Offset
             *
             * @param lineDashIII float
             * @return Builder
             */
            public Builder lineDashIII(float lineDashIII) {
                this.lineDashIII = lineDashIII;
                return this;
            }

            /**
             * build
             *
             * @return ShapeStyle
             */
            @Override
            public ShapeStyle build() {
                return new ShapeStyle(fill, stroke, strokeWidth, lineCap, lineJoin, miterLimit, lineDashI, lineDashII, lineDashIII, super.buildUnknownFields());
            }
        }

        public static final class RGBAColor extends Message<RGBAColor, RGBAColor.Builder> {
            public static final ProtoAdapter<RGBAColor> ADAPTER = new ProtoAdapter_RGBAColor();
            public static final float DEFAULT_R = 0.0f;
            public static final float DEFAULT_G = 0.0f;
            public static final float DEFAULT_B = 0.0f;
            public static final float DEFAULT_A = 0.0f;

            @WireField(
                    tag = 1,
                    adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
            )
            public float r;

            @WireField(
                    tag = 2,
                    adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
            )
            public float g;

            @WireField(
                    tag = 3,
                    adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
            )
            public float b;

            @WireField(
                    tag = 4,
                    adapter = "com.squareup.wire.ProtoAdapter#FLOAT"
            )
            public float a;

            /**
             * RGBAColor
             *
             * @param r float
             * @param g float
             * @param b float
             * @param a float
             */
            public RGBAColor(float r, float g, float b, float a) {
                this(r, g, b, a, ByteString.EMPTY);
            }

            /**
             * RGBAColor
             *
             * @param r             float
             * @param g             float
             * @param b             float
             * @param a             float
             * @param unknownFields ByteString
             */
            public RGBAColor(float r, float g, float b, float a, ByteString unknownFields) {
                super(ADAPTER, unknownFields);
                this.r = r;
                this.g = g;
                this.b = b;
                this.a = a;
            }

            /**
             * newBuilder
             *
             * @return Builder
             */
            @Override
            public Builder newBuilder() {
                Builder builder = new Builder();
                builder.r = r;
                builder.g = g;
                builder.b = b;
                builder.a = a;
                builder.addUnknownFields(unknownFields());
                return builder;
            }

            /**
             * equals
             *
             * @param other Object
             * @return boolean
             */
            @Override
            public boolean equals(Object other) {
                if (other == this) return true;
                if (!(other instanceof RGBAColor)) return false;
                RGBAColor o = (RGBAColor) other;
                return unknownFields().equals(o.unknownFields())
                        && Internal.equals(r, o.r)
                        && Internal.equals(g, o.g)
                        && Internal.equals(b, o.b)
                        && Internal.equals(a, o.a);
            }

            /**
             * hashCode
             *
             * @return int
             */
            @Override
            public int hashCode() {
                int result = super.hashCode;
                if (result == 0) {
                    result = unknownFields().hashCode();
                    result = result * 37 + (new Float(r).hashCode());
                    result = result * 37 + (new Float(g).hashCode());
                    result = result * 37 + (new Float(b).hashCode());
                    result = result * 37 + (new Float(a).hashCode());
                    super.hashCode = result;
                }
                return result;
            }

            /**
             * toString
             *
             * @return String
             */
            @Override
            public String toString() {
                StringBuilder builder = new StringBuilder();
                builder.append(", r=").append(r);
                builder.append(", g=").append(g);
                builder.append(", b=").append(b);
                builder.append(", a=").append(a);
                return builder.replace(0, 2, "RGBAColor{").append('}').toString();
            }

            public static final class Builder extends Message.Builder<RGBAColor, Builder> {
                public float r = 0.0f;
                public float g = 0.0f;
                public float b = 0.0f;
                public float a = 0.0f;

                /**
                 * Builder
                 */
                public Builder() {
                }

                /**
                 * r
                 *
                 * @param r float
                 * @return Builder
                 */
                public Builder r(float r) {
                    this.r = r;
                    return this;
                }

                /**
                 * g
                 *
                 * @param g float
                 * @return Builder
                 */
                public Builder g(float g) {
                    this.g = g;
                    return this;
                }

                /**
                 * b
                 *
                 * @param b float
                 * @return Builder
                 */
                public Builder b(float b) {
                    this.b = b;
                    return this;
                }

                /**
                 * a
                 *
                 * @param a float
                 * @return Builder
                 */
                public Builder a(float a) {
                    this.a = a;
                    return this;
                }

                /**
                 * build
                 *
                 * @return RGBAColor
                 */
                @Override
                public RGBAColor build() {
                    return new RGBAColor(r, g, b, a, super.buildUnknownFields());
                }
            }

            private static class ProtoAdapter_RGBAColor extends ProtoAdapter<RGBAColor> {
                ProtoAdapter_RGBAColor() {
                    super(FieldEncoding.LENGTH_DELIMITED, RGBAColor.class);
                }

                /**
                 * encodedSize
                 *
                 * @param value RGBAColor
                 * @return int
                 */
                @Override
                public int encodedSize(RGBAColor value) {
                    return ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.r)
                            + ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.g)
                            + ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.b)
                            + ProtoAdapter.FLOAT.encodedSizeWithTag(4, value.a)
                            + value.unknownFields().size();
                }

                /**
                 * encode
                 *
                 * @param writer ProtoWriter
                 * @param value  RGBAColor
                 * @throws IOException
                 */
                @Override
                public void encode(ProtoWriter writer, RGBAColor value) throws IOException {
                    ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.r);
                    ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.g);
                    ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.b);
                    ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.a);
                    writer.writeBytes(value.unknownFields());
                }

                /**
                 * decode
                 *
                 * @param reader ProtoReader
                 * @return RGBAColor
                 * @throws IOException
                 */
                @Override
                public RGBAColor decode(ProtoReader reader) throws IOException {
                    Builder builder = new Builder();
                    long token = reader.beginMessage();
                    for (int tag; (tag = reader.nextTag()) != -1; ) {
                        switch (tag) {
                            case 1:
                                builder.r(ProtoAdapter.FLOAT.decode(reader));
                                break;
                            case 2:
                                builder.g(ProtoAdapter.FLOAT.decode(reader));
                                break;
                            case 3:
                                builder.b(ProtoAdapter.FLOAT.decode(reader));
                                break;
                            case 4:
                                builder.a(ProtoAdapter.FLOAT.decode(reader));
                                break;
                            default: {
                                FieldEncoding fieldEncoding = reader.peekFieldEncoding();
                                Object value = fieldEncoding.rawProtoAdapter().decode(reader);
                                builder.addUnknownField(tag, fieldEncoding, value);
                            }
                        }
                    }
                    reader.endMessage(token);
                    return builder.build();
                }

                /**
                 * redact
                 *
                 * @param value RGBAColor
                 * @return RGBAColor
                 */
                @Override
                public RGBAColor redact(RGBAColor value) {
                    Builder builder = value.newBuilder();
                    builder.clearUnknownFields();
                    return builder.build();
                }
            }
        }

        public enum LineCap implements WireEnum {
            LineCap_BUTT(0),
            LineCap_ROUND(1),
            LineCap_SQUARE(2);

            public static final ProtoAdapter<LineCap> ADAPTER = ProtoAdapter.newEnumAdapter(LineCap.class);

            private int value;

            LineCap(int value) {
                this.value = value;
            }

            /**
             * Return the constant for {@code value} or null.
             *
             * @param value int
             * @return LineCap
             */
            public static LineCap fromValue(int value) {
                switch (value) {
                    case 0:
                        return LineCap_BUTT;
                    case 1:
                        return LineCap_ROUND;
                    case 2:
                        return LineCap_SQUARE;
                    default:
                        return null;
                }
            }

            /**
             * getValue
             *
             * @return int
             */
            @Override
            public int getValue() {
                return value;
            }
        }

        public enum LineJoin implements WireEnum {
            LineJoin_MITER(0),
            LineJoin_ROUND(1),
            LineJoin_BEVEL(2);

            public static final ProtoAdapter<LineJoin> ADAPTER = ProtoAdapter.newEnumAdapter(LineJoin.class);

            private int value;

            LineJoin(int value) {
                this.value = value;
            }

            /**
             * Return the constant for {@code value} or null.
             *
             * @param value int
             * @return LineJoin
             */
            public static LineJoin fromValue(int value) {
                switch (value) {
                    case 0:
                        return LineJoin_MITER;
                    case 1:
                        return LineJoin_ROUND;
                    case 2:
                        return LineJoin_BEVEL;
                    default:
                        return null;
                }
            }

            /**
             * getValue
             *
             * @return int
             */
            @Override
            public int getValue() {
                return value;
            }
        }

        private static class ProtoAdapter_ShapeStyle extends ProtoAdapter<ShapeStyle> {
            ProtoAdapter_ShapeStyle() {
                super(FieldEncoding.LENGTH_DELIMITED, ShapeStyle.class);
            }

            /**
             * encodedSize
             *
             * @param value ShapeStyle
             * @return int
             */
            @Override
            public int encodedSize(ShapeStyle value) {
                return (value.fill != null ? RGBAColor.ADAPTER.encodedSizeWithTag(1, value.fill) : 0)
                        + (value.stroke != null ? RGBAColor.ADAPTER.encodedSizeWithTag(2, value.stroke) : 0)
                        + ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.strokeWidth)
                        + (value.lineCap != null ? LineCap.ADAPTER.encodedSizeWithTag(4, value.lineCap) : 0)
                        + (value.lineJoin != null ? LineJoin.ADAPTER.encodedSizeWithTag(5, value.lineJoin) : 0)
                        + ProtoAdapter.FLOAT.encodedSizeWithTag(6, value.miterLimit)
                        + ProtoAdapter.FLOAT.encodedSizeWithTag(7, value.lineDashI)
                        + ProtoAdapter.FLOAT.encodedSizeWithTag(8, value.lineDashII)
                        + ProtoAdapter.FLOAT.encodedSizeWithTag(9, value.lineDashIII)
                        + value.unknownFields().size();
            }

            /**
             * encode
             *
             * @param writer ProtoWriter
             * @param value  ShapeStyle
             * @throws IOException
             */
            @Override
            public void encode(ProtoWriter writer, ShapeStyle value) throws IOException {
                if (value.fill != null) RGBAColor.ADAPTER.encodeWithTag(writer, 1, value.fill);
                if (value.stroke != null) RGBAColor.ADAPTER.encodeWithTag(writer, 2, value.stroke);
                ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.strokeWidth);
                if (value.lineCap != null) LineCap.ADAPTER.encodeWithTag(writer, 4, value.lineCap);
                if (value.lineJoin != null)
                    LineJoin.ADAPTER.encodeWithTag(writer, 5, value.lineJoin);
                ProtoAdapter.FLOAT.encodeWithTag(writer, 6, value.miterLimit);
                ProtoAdapter.FLOAT.encodeWithTag(writer, 7, value.lineDashI);
                ProtoAdapter.FLOAT.encodeWithTag(writer, 8, value.lineDashII);
                ProtoAdapter.FLOAT.encodeWithTag(writer, 9, value.lineDashIII);
                writer.writeBytes(value.unknownFields());
            }

            /**
             * decode
             *
             * @param reader ProtoReader
             * @return ShapeStyle
             * @throws IOException
             */
            @Override
            public ShapeStyle decode(ProtoReader reader) throws IOException {
                Builder builder = new Builder();
                long token = reader.beginMessage();
                for (int tag; (tag = reader.nextTag()) != -1; ) {
                    switch (tag) {
                        case 1:
                            builder.fill(RGBAColor.ADAPTER.decode(reader));
                            break;
                        case 2:
                            builder.stroke(RGBAColor.ADAPTER.decode(reader));
                            break;
                        case 3:
                            builder.strokeWidth(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        case 4: {
                            try {
                                builder.lineCap(LineCap.ADAPTER.decode(reader));
                            } catch (ProtoAdapter.EnumConstantNotFoundException e) {
                                builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value);
                            }
                            break;
                        }
                        case 5: {
                            try {
                                builder.lineJoin(LineJoin.ADAPTER.decode(reader));
                            } catch (ProtoAdapter.EnumConstantNotFoundException e) {
                                builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value);
                            }
                            break;
                        }
                        case 6:
                            builder.miterLimit(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        case 7:
                            builder.lineDashI(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        case 8:
                            builder.lineDashII(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        case 9:
                            builder.lineDashIII(ProtoAdapter.FLOAT.decode(reader));
                            break;
                        default: {
                            FieldEncoding fieldEncoding = reader.peekFieldEncoding();
                            Object value = fieldEncoding.rawProtoAdapter().decode(reader);
                            builder.addUnknownField(tag, fieldEncoding, value);
                        }
                    }
                }
                reader.endMessage(token);
                return builder.build();
            }

            /**
             * redact
             *
             * @param value ShapeStyle
             * @return ShapeStyle
             */
            @Override
            public ShapeStyle redact(ShapeStyle value) {
                Builder builder = value.newBuilder();
                if (builder.fill != null) builder.fill = RGBAColor.ADAPTER.redact(builder.fill);
                if (builder.stroke != null)
                    builder.stroke = RGBAColor.ADAPTER.redact(builder.stroke);
                builder.clearUnknownFields();
                return builder.build();
            }
        }
    }

    private static class ProtoAdapter_ShapeEntity extends ProtoAdapter<ShapeEntity> {
        ProtoAdapter_ShapeEntity() {
            super(FieldEncoding.LENGTH_DELIMITED, ShapeEntity.class);
        }

        /**
         * encodedSize
         *
         * @param value ShapeEntity
         * @return int
         */
        @Override
        public int encodedSize(ShapeEntity value) {
            return (value.type != null ? ShapeType.ADAPTER.encodedSizeWithTag(1, value.type) : 0)
                    + (value.styles != null ? ShapeStyle.ADAPTER.encodedSizeWithTag(10, value.styles) : 0)
                    + (value.transform != null ? Transform.ADAPTER.encodedSizeWithTag(11, value.transform) : 0)
                    + (value.shape != null ? ShapeArgs.ADAPTER.encodedSizeWithTag(2, value.shape) : 0)
                    + (value.rect != null ? RectArgs.ADAPTER.encodedSizeWithTag(3, value.rect) : 0)
                    + (value.ellipse != null ? EllipseArgs.ADAPTER.encodedSizeWithTag(4, value.ellipse) : 0)
                    + value.unknownFields().size();
        }

        /**
         * encode
         *
         * @param writer ProtoWriter
         * @param value  ShapeEntity
         * @throws IOException
         */
        @Override
        public void encode(ProtoWriter writer, ShapeEntity value) throws IOException {
            if (value.type != null) ShapeType.ADAPTER.encodeWithTag(writer, 1, value.type);
            if (value.styles != null) ShapeStyle.ADAPTER.encodeWithTag(writer, 10, value.styles);
            if (value.transform != null)
                Transform.ADAPTER.encodeWithTag(writer, 11, value.transform);
            if (value.shape != null) ShapeArgs.ADAPTER.encodeWithTag(writer, 2, value.shape);
            if (value.rect != null) RectArgs.ADAPTER.encodeWithTag(writer, 3, value.rect);
            if (value.ellipse != null) EllipseArgs.ADAPTER.encodeWithTag(writer, 4, value.ellipse);
            writer.writeBytes(value.unknownFields());
        }

        /**
         * decode
         *
         * @param reader ProtoReader
         * @return ShapeEntity
         * @throws IOException
         */
        @Override
        public ShapeEntity decode(ProtoReader reader) throws IOException {
            Builder builder = new Builder();
            long token = reader.beginMessage();
            for (int tag; (tag = reader.nextTag()) != -1; ) {
                switch (tag) {
                    case 1: {
                        try {
                            builder.type(ShapeType.ADAPTER.decode(reader));
                        } catch (ProtoAdapter.EnumConstantNotFoundException e) {
                            builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value);
                        }
                        break;
                    }
                    case 10:
                        ShapeStyle decode = ShapeStyle.ADAPTER.decode(reader);

                        builder.styles(decode);
                        break;
                    case 11:
                        builder.transform(Transform.ADAPTER.decode(reader));
                        break;
                    case 2:
                        builder.shape(ShapeArgs.ADAPTER.decode(reader));
                        break;
                    case 3:
                        builder.rect(RectArgs.ADAPTER.decode(reader));
                        break;
                    case 4:
                        builder.ellipse(EllipseArgs.ADAPTER.decode(reader));
                        break;
                    default: {
                        FieldEncoding fieldEncoding = reader.peekFieldEncoding();
                        Object value = fieldEncoding.rawProtoAdapter().decode(reader);
                        builder.addUnknownField(tag, fieldEncoding, value);
                    }
                }
            }
            reader.endMessage(token);
            return builder.build();
        }

        /**
         * redact
         *
         * @param value ShapeEntity
         * @return ShapeEntity
         */
        @Override
        public ShapeEntity redact(ShapeEntity value) {
            Builder builder = value.newBuilder();
            if (builder.styles != null) builder.styles = ShapeStyle.ADAPTER.redact(builder.styles);
            if (builder.transform != null)
                builder.transform = Transform.ADAPTER.redact(builder.transform);
            if (builder.shape != null) builder.shape = ShapeArgs.ADAPTER.redact(builder.shape);
            if (builder.rect != null) builder.rect = RectArgs.ADAPTER.redact(builder.rect);
            if (builder.ellipse != null)
                builder.ellipse = EllipseArgs.ADAPTER.redact(builder.ellipse);
            builder.clearUnknownFields();
            return builder.build();
        }
    }
}
